#ifndef RENDER_H
#define RENDER_H
#include <string>
#include <vector>
#include "opencv2/opencv.hpp"
#include "common.h"
#include "settings.h"

using std::string;
class Render
{
	using track_info = std::vector<Track_Info>;
public:
	Render(const string& background, const string& person, const Door_Params& door, int mode=0);
	cv::Mat render(cv::Mat frame, track_info& track_s, const TotalInfo& info_s, bool draw_rect = false)const;
	
private:
	void draw_histgram(cv::Mat background, const std::vector<int>& num_in, int end_index) const;
	cv::Mat draw_circularmap(cv::Mat background, int num_in, int num_m, int num_w, int num_h, int num_nh, int num_out)const;
	void draw_track(cv::Mat frame, std::vector<std::pair<cv::Point, bool>>& track_points, int track_id)const;
	void draw_track_info(cv::Mat frame, Track_Info& track)const;
	void draw_info(cv::Mat background, const TotalInfo& info_s)const;
	void draw_tracker(cv::Mat frame, track_info& track_s)const;
	void draw_track_rect(cv::Mat frame, track_info& track_s)const;
	void draw_person_in_out(cv::Mat background, const TotalInfo& info_s)const;
	void draw_age(cv::Mat background, const std::vector<int>& age_sum)const;

	std::string int_to_string(int i)const;
private:
	cv::Mat background_image;
	cv::Mat person_image;
	std::vector<int> door_line;
	std::vector<cv::Scalar> m_colors;
	cv::Mat last_render;
	int mode = 0;
	std::vector<std::string> age_text = {
		"0-3",
		"4-12",
		"13-20",
		"21-35",
		"36-50",
		"51-70",
		"71-"
	};

	RenderSettings m_settings;
};

#endif // !RENDER_H
